local rolely_jiuchi = fk.CreateSkill {
    name = "rolely_jiuchi",
}

Fk:loadTranslationTable {
    ["rolely_jiuchi"] = "酒池",
    [":rolely_jiuchi"] = "你可以将一张♠手牌当【酒】使用；当你使用【酒】时，你可以令一名角色本回合无法使用或打出一种花色的牌。",

    ["#rolely_jiuchi"] = "酒池：你可以将一张♠手牌当【酒】使用",
    ["@rolely_jiuchi-turn"] = "酒池",

    ["$rolely_jiuchi1"] = "酒中罹魂千万，老夫一觞饮之！",
    ["$rolely_jiuchi2"] = "金樽且行乐，无酒无中原！",
}

rolely_jiuchi:addEffect("viewas", {
    anim_type = "offensive",
    pattern = "analeptic",
    prompt = "#rolely_jiuchi",
    handly_pile = true,
    card_filter = function(self, player, to_select, selected)
        return #selected == 0 and Fk:getCardById(to_select).suit == Card.Spade and
            table.contains(player:getHandlyIds(), to_select)
    end,
    view_as = function(self, player, cards)
        if #cards ~= 1 then return end
        local c = Fk:cloneCard("analeptic")
        c.skillName = rolely_jiuchi.name
        c:addSubcard(cards[1])
        return c
    end,
    enabled_at_response = function(self, player, response)
        return not response
    end,
})
rolely_jiuchi:addEffect(fk.CardUsing, {
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(rolely_jiuchi.name) and target == player and
            data.card.trueName == "analeptic"
    end,
    on_cost = function(self, event, target, player, data)
        local room = player.room
        local tos = room:askToChoosePlayers(player, {
            skill_name = rolely_jiuchi.name,
            min_num = 1,
            max_num = 1,
            targets = room:getOtherPlayers(player, false),
            prompt = "酒池：选择一名角色，令其无法打出一种花色的牌",
            cancelable = true,
        })
        if #tos > 0 then
            event:setCostData(self, { tos = tos })
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        local room = player.room
        local to = event:getCostData(self).tos[1]
        local all_choices = { "log_spade", "log_heart", "log_club", "log_diamond" }
        local choices = table.filter(all_choices, function(suit)
            return not table.contains(to:getTableMark("@rolely_jiuchi-turn"), suit)
        end)
        local choice = room:askToChoice(player, {
            choices = choices, skill_name = rolely_jiuchi.name, prompt = "酒池：请选择一种花色", all_choices = all_choices,
        })
        room:addTableMark(to, "@rolely_jiuchi-turn", choice)
    end,
})

rolely_jiuchi:addEffect("prohibit", {
    prohibit_use = function(self, player, card)
        return card and #player:getTableMark("@rolely_jiuchi-turn") > 0 and
            table.contains(player:getTableMark("@rolely_jiuchi-turn"), card:getSuitString(true))
    end,
})
return rolely_jiuchi
